Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(cli): exports json schema #2362

Merged
merged 12 commits into from
Jun 25, 2024
Merged

Conversation

bodinsamuel
Copy link
Contributor

@bodinsamuel bodinsamuel commented Jun 18, 2024

Describe your changes

Fixes https://linear.app/nango/issue/NAN-1154/produce-json-schema-locally
Fixes https://linear.app/nango/issue/NAN-1155/upload-json-schema-when-deploying

  • Output schema.ts and schema.json in .nango/ folder
    We decided to not output additional stuff at the root level to avoid cluttering the main folder. Customers can choose what they to commit. And we will add more output in the coming weeks/months (most likely zod, then others languages maybe)

  • Rename load to loadValidateParse
    For clarification because it wasn't super obvious it could fail with validation error.

  • Touch a bit deploy.service to prepare new files to be sent but the logic is the same as before (not yet sending json)

@bodinsamuel bodinsamuel self-assigned this Jun 18, 2024
Copy link

linear bot commented Jun 18, 2024

@bodinsamuel bodinsamuel marked this pull request as ready for review June 21, 2024 14:28
action.name,
providerConfigKey,
'./'
);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check now done by loadScriptFiles

packages/cli/lib/index.ts Outdated Show resolved Hide resolved
packages/cli/lib/services/dryrun.service.ts Show resolved Hide resolved
@bodinsamuel
Copy link
Contributor Author

@khaliqgant happy to get your review on this change

@bodinsamuel bodinsamuel requested a review from TBonnin June 24, 2024 15:25
@khaliqgant khaliqgant self-requested a review June 24, 2024 16:23
Copy link
Member

@khaliqgant khaliqgant left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Issue with removed line in the deploy process.

Looks great otherwise!

Notice that

    date_created: date
    date_last_modified: date

produces

        "date_created": {
          "type": "string",
          "format": "date-time"
        },
        "date_last_modified": {
          "type": "string",
          "format": "date-time"
        }

which is most accurate but I have been putting

    date_created: string
    date_last_modified: string

because they are in fact strings and I find it confusing otherwise, but curious on your thoughts in line of this json schema output?

@bodinsamuel
Copy link
Contributor Author

Notice that [...] date

I'm fine with this. I personally think it was a not a good idea to support date, because it is not json portable and JS Date default output is not ISO, but we decided to support it so the json schema is only reflecting that.
Note that the JSON schema is also expecting string but with a specific format so it won't break anything regarding your setup (or any setup I think)

@khaliqgant khaliqgant self-requested a review June 25, 2024 08:10
@bodinsamuel bodinsamuel merged commit a40e180 into master Jun 25, 2024
20 checks passed
@bodinsamuel bodinsamuel deleted the feat/cli-exports-json-schema branch June 25, 2024 08:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants